Skip to content

fix(release): serialize integrated canary smoke, cap macOS shards, add --ensure-chat-bundle - #10248

Merged
loopx-agent merged 1 commit into
mainfrom
codex/opt-release-qualification-efficiency-20261206
Dec 6, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/opt-release-qualification-efficiency-20261206

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

Improves release qualification and pre-merge canary pipeline reliability without altering existing default qualification semantics:

  1. Serial isolation for latency-budgeted canary smoke (loopx/canary/runner.py):
    • Add control-plane-integrated-canary-smoke.py to SERIAL_SMOKE_SCRIPTS with rationale: it enforces a strict <= 60s wall-clock latency budget across real File+SQLite loops and can false-fail under parallel CPU contention (~74.18s > 60s under full-public --jobs 4 vs ~14.9s isolated serial).
  2. macOS default shard capping (scripts/qualify_release_commit.py):
    • Update default_pytest_parallelism(cpu_count=None, *, platform_name=None) so darwin caps default single-wave shard concurrency at min(8, max(1, cpus // 2)) (8 shards on 18-core Apple Silicon instead of 12, avoiding P-core oversubscription timeouts), while preserving Linux max(1, min(12, round(cpus * 2 / 3))) and explicit --shards overrides unchanged.
  3. Opt-in chat bundle verification/build (scripts/qualify_release_commit.py):
    • Add opt-in --ensure-chat-bundle (default False for full CLI parity). When enabled on a clean checkout, it verifies scripts/chat_bundle.py verify --source, builds and re-verifies (build --install + verify --source) into gitignored /loopx/web/chat/ if needed, and re-verifies clean git source identity.
  4. Focused unit tests:
    • tests/canary/test_premerge_parallel_and_dedup.py: verify control-plane-integrated-canary-smoke.py serial classification and execution ordering under parallel_jobs=4.
    • tests/control_plane/test_release_commit_qualification.py: verify default_pytest_parallelism across core counts on darwin and linux, --shards override parity, and --ensure-chat-bundle default-off and opt-in build/re-verify behavior.

Local Verification (Source Checkout)

  • uv run --extra test python -m pytest -q tests/canary/test_premerge_parallel_and_dedup.py tests/control_plane/test_release_commit_qualification.py -> 51 passed
  • uv run --extra test ruff check loopx/canary/runner.py scripts/qualify_release_commit.py tests/canary/test_premerge_parallel_and_dedup.py tests/control_plane/test_release_commit_qualification.py -> All checks passed!
  • uv run --extra test mypy --follow-imports=silent loopx/canary/runner.py scripts/qualify_release_commit.py -> Success: no issues found in 2 source files
  • loopx check --scan-path ... -> errors=0, public boundary scan clean (4 files)
  • loopx --format json canary premerge --from-git-diff --git-diff-base origin/main -j 1 -> ok: true, direct_check_count: 6, selected_check_count: 18, executed_check_count: 18, failure_count: 0

…d --ensure-chat-bundle

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google · self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

受影响对象与触发任务:运行 full-public 套件的开发者与执行 scripts/qualify_release_commit.py 的本地发布资格操作者。改进前,在 18 核 Apple Silicon 上执行发布资格检查时,12 分片并发会压满性能核引发 10s 超时,full-public --jobs 4 会把约 14.9s 的集成冒烟拖到 74.18s 失败;改进后,集成冒烟自动在并发批次结束后串行执行,macOS 默认并发收敛至 8 分片,按需可附带 --ensure-chat-bundle 校验或构建前端包且不污染受跟踪文件。可观测改进效果:control-plane-integrated-canary-smoke.py 在 parallel_jobs=4 时被排入串行收尾阶段;default_pytest_parallelism 在 18 核 macOS 返回 8 而 Linux 保持 12;--ensure-chat-bundle 默认关闭且开启时仅在 verify --source 失败时执行 build --install 与二次 verify。非目标边界:不修改 Linux 分片公式,不改变已有 --shards 显式参数语义,也不将 --ensure-chat-bundle 设为默认行为。

改动思路 / Approach

整体设计遵循最小复用原则:三项机制均直接落在既有权威边界内,未引入新状态拥有者或跨层耦合。当前 PR 边界:仅包含上述三项独立可验证、可逆的发布流水线改进及对应单测。具体而言,针对集成冒烟的 CPU 竞争问题,直接在 loopx/canary/runner.py 的 SERIAL_SMOKE_SCRIPTS 注册表登记 control-plane-integrated-canary-smoke.py,复用两阶段调度机制在普通并发冒烟之后串行执行,避免放宽 60s 硬延迟预算而掩盖真实性能回归;针对 macOS 并发超卖,在 scripts/qualify_release_commit.py 的 default_pytest_parallelism 增加 platform_name 感知,将 darwin 收敛至 min(8, max(1, cpus // 2));针对前端包准备,以默认关闭的 --ensure-chat-bundle 调用既有 scripts/chat_bundle.py,并在前后两次调用 _require_clean_source 保证洁净树约束。

具体改动 / Changes

依据规格文档 docs/product/release-readiness.md(提交基线 a54c53d25afdaa53a710141095b831cafb42b12d)中的单波分片并发与洁净源码检出约定,本 PR 三项验收标准均已落实:OPT1-SERIAL-CANARY(implemented)、OPT1-DARWIN-SHARDS(implemented)、OPT1-ENSURE-CHAT-BUNDLE(implemented)。

关键代码讲解

  1. SERIAL_SMOKE_SCRIPTS(loopx/canary/runner.py):新增 "control-plane-integrated-canary-smoke.py" 条目并附简洁原因说明。在 build_canary_smoke_suite_run 中,_serial_smoke_reason 按规范化命令的脚本 basename 精确查表,将其归入 serial_indexes,使其在并行 ThreadPoolExecutor 阶段结束后按序执行并打上 serial_execution_required=True 标记。
  2. default_pytest_parallelism(scripts/qualify_release_commit.py):新增关键字参数 platform_name: str | None = None。当 (platform_name or sys.platform).lower() == "darwin" 时返回 min(8, max(1, cpus // 2))(18 核 Apple Silicon 返回 8),其余平台保持 max(1, min(12, round(cpus * 2 / 3))),且显式 --shards 覆盖不受影响。
  3. _ensure_chat_bundle 与 main(scripts/qualify_release_commit.py):_ensure_chat_bundle 先运行 scripts/chat_bundle.py verify --source(捕获子进程输出避免污染 JSON stdout),返回 0 时直接返回;非零时依次运行 build --install 与二次 verify --source,任一步失败即抛出含错误详情的 RuntimeError。main 仅在 args.ensure_chat_bundle 为真时于初始 _require_clean_source 后调用它,并在完成后再次校验 post_bundle_source == source。

对主干的风险 / Risks

本次改动面窄且可逆,主要风险边界及防控措施如下:

  1. 默认分片变更与测试兼容:在 macOS 宿主机直接无参调用 default_pytest_parallelism(18) 的返回值由 12 收敛至 8,已同步更新 tests/control_plane/test_release_commit_qualification.py 明确覆写测试 darwin 与 linux 及 --shards 覆盖语义。
  2. --ensure-chat-bundle 默认关闭隔离与脏树防护:未传递该开关时 main 完全跳过 _ensure_chat_bundle,保持 100% 默认路径等价性(单测已证实不触发 chat_bundle.py);启用时前后的双次 _require_clean_source 校验会阻断任何非 gitignored 改动。
  3. 残余边界:单测中对 _run_check 及临时仓库中 chat_bundle.py 使用轻量桩替代完整 Vite 构建,真实 8 分片全量发布资格运行留待发布候选提交门禁执行。

我的整体评价 / Verdict

本 PR 精准解决发布流水线中的真实可靠性痛点,long_horizon 与 user_experience 均判断为 improved(UI 视觉评审 not_applicable),code_volume(necessary)、change_proportionality(proportionate)、architecture_assessment(retain)、default_off_isolation(isolated)、authority_semantics(aligned)及 semantic_alignment(aligned / local_only)均满足要求,且 observable_semantics 已验证为 intentional_change_validated。

本地验证汇总(exact head 5410795411e4d6e643c78b562b63dbec85d33af1):

  • 针对性单测(uv run --extra test python -m pytest -q tests/canary/test_premerge_parallel_and_dedup.py tests/control_plane/test_release_commit_qualification.py):PASS(51 passed in 22.82s)
  • 代码规范与类型检查(ruff check 4 files & mypy --follow-imports=silent 2 files):PASS
  • 公共边界检查(loopx check --scan-path ...):PASS(errors=0,4 files clean)
  • Pre-merge 门禁(loopx canary premerge --from-git-diff --git-diff-base origin/main -j 1):PASS(6 direct checks + 18/18 smokes passed,含 semantic-vocabulary-drift-smoke.py)

English verdict: APPROVE PR #10248 at exact head 5410795 — serial isolation for control-plane-integrated-canary-smoke.py, darwin shard cap at 8, and opt-in --ensure-chat-bundle with clean-source enforcement are locally verified with 51/51 targeted pytest cases, ruff/mypy, public boundary scan, and 18/18 canary premerge checks passing.

@loopx-agent
loopx-agent merged commit c4564eb into main Dec 6, 2026
18 of 22 checks passed
@loopx-agent
loopx-agent deleted the codex/opt-release-qualification-efficiency-20261206 branch December 6, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant